#include <iostream>
#include <string>
#include <thread>
#include <unordered_map>

#include "runtime/engine.h"

#include "editor/include/editor.h"

// https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html
#define MOYU2_XSTR(s) MOYU2_STR(s)
#define MOYU2_STR(s) #s

int main(int argc, char** argv)
{
    std::filesystem::path pilot_root_folder = std::filesystem::path(MOYU2_XSTR(MOYU2_ROOT_DIR));

    MoYu2::EngineInitParams params;
    params.m_root_folder      = pilot_root_folder;
    params.m_config_file_path = pilot_root_folder / "MoYu2Editor.ini";

    MoYu2::MoYu2Engine* engine = new MoYu2::MoYu2Engine();

    engine->startEngine(params);
    engine->initialize();

    MoYu2::MoYu2Editor* editor = new MoYu2::MoYu2Editor();
    editor->initialize(engine);

    editor->run();

    editor->clear();

    engine->clear();
    engine->shutdownEngine();

    return 0;
}
